package com.polaris.live.adapter

import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.common.ext.dp
import com.polaris.live.databinding.AdapterGameItemBinding
import com.polaris.live.resp.back_resp.GameVo
import com.polaris.live.utils.image.ImageUtils

/**
 * GameAdapter
 *
 * @author Created by 半仙 on 2023/10/16/016 20:29
 */
class GameAdapter : BaseBindingAdapter<AdapterGameItemBinding, GameVo>() {

    override fun convert(holder: VBViewHolder<AdapterGameItemBinding>, item: GameVo) {
        holder.vb.apply {
            gameName.text = item.name
            Glide.with(gameImg.context).load(ImageUtils.imgPath(item.iconRound))
                .transform(RoundedCorners(8.dp)).into(gameImg)
        }
    }

    fun setSelect(position: Int): GameVo {
        return data[position]
    }

}